<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$params = array('status'=>100);
	$return['list']=array();
	$return['params']=$params;
	set_html('title',$setting['title']?'兑换券-'.$setting['title']:'兑换券-优品送礼');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$params = array('uniacid'=>$_SESSION['uniacid'],'smid'=>$_SESSION['uid']);
	if(isset($_RQ['status']) && $_RQ['status'] != 100){
		$params['status']=intval($_RQ['status']);
		$return['status']=$_RQ['status'];
	}
	$return['type']=$_RQ['type'];
	$pindex = max(1, intval($post['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_sendgoods_ex_log',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	foreach($list as &$row){
		$order=pdo_get('jy_sendgoods_order',array('id'=>$item['order_id'],'uniacid'=>$_SESSION['uniacid']));
		$item['goods']=pdo_get('jy_weishop_goods',array('id'=>$order['goodsid'],'uniacid'=>$_SESSION['uniacid']));
		$item['sendmember']=pdo_get('core_members',array('id'=>$order['mid'],'uniacid'=>$_SESSION['uniacid']));
		//$item['store']=pdo_get('jy_weishop_store',array('id'=>$item['storeid'],'uniacid'=>$_SESSION['uniacid']));
		$item['createtime']=date("Y-m-d H:i",$item['createtime']);

	}
	$return['list']=$list;
	set_html('title',$setting['title']?'兑换券-'.$setting['title']:'兑换券-优品送礼');
	exi($return);
}	
?>